/**
 * 智能问答的js api
 */
import request from "@/utils/request";

/**
 * 保存清单选项标题数据
 * @param {*} data
 */
export function saveOrUpdateDetailListTitle(data) {
  return request({
    url:
      process.env.VUE_APP_KSTB_ROUTE_PATH +
      "/yxpz/detailListOptionTitle/saveOrUpdate",
    method: "post",
    headers: {
      "Content-Type": "application/json;charset=UTF-8"
    },
    data: data
  });
}

/**
 * 根据hdlOid查询选项标题集合数据，包含选项标题的值集合数据
 * @param {*} hdlOid
 */
export function queryDetailListOptionTitleByHdlOid(hdlOid) {
  return request({
    url:
      process.env.VUE_APP_KSTB_ROUTE_PATH +
      `/yxpz/detailListOptionTitle/queryDetailListOptionTitleByHdlOid/${hdlOid}`,
    method: "post",
    headers: {
      "Content-Type": "application/json;charset=UTF-8"
    }
  });
}

/**
 * 根据id查询选项title数据，包含的值数据集合
 * @param {*} id
 */
export function getDetailListTitleById(id) {
  return request({
    url:
      process.env.VUE_APP_KSTB_ROUTE_PATH +
      `/yxpz/detailListOptionTitle/getDetailListTitleById/${id}`,
    method: "post",
    headers: {
      "Content-Type": "application/json;charset=UTF-8"
    }
  });
}

/**
 * 选项标题上移
 * @param {*} id
 */
export function upSortById(id) {
  return request({
    url:
      process.env.VUE_APP_KSTB_ROUTE_PATH +
      `/yxpz/detailListOptionTitle/upSortById/${id}`,
    method: "post",
    headers: {
      "Content-Type": "application/json;charset=UTF-8"
    }
  });
}

/**
 * 选项标题下移
 * @param {*} id
 */
export function downSortById(id) {
  return request({
    url:
      process.env.VUE_APP_KSTB_ROUTE_PATH +
      `/yxpz/detailListOptionTitle/downSortById/${id}`,
    method: "post",
    headers: {
      "Content-Type": "application/json;charset=UTF-8"
    }
  });
}

/**
 * 根据id删除选项标题数据和关联的选项值数据
 * @param {*} id
 */
export function deleteById(id) {
  return request({
    url:
      process.env.VUE_APP_KSTB_ROUTE_PATH +
      `/yxpz/detailListOptionTitle/deleteById/${id}`,
    method: "post",
    headers: {
      "Content-Type": "application/json;charset=UTF-8"
    }
  });
}

/**
 * 保存或更新选项值和材料的关联关系
 * @param {*} data
 */
export function saveOrUpdateValueMaterialsRel(data) {
  return request({
    url:
      process.env.VUE_APP_KSTB_ROUTE_PATH +
      `/yxpz/optionValueMaterialsRel/saveOrUpdate`,
    method: "get",
    headers: {
      "Content-Type": "application/json;charset=UTF-8"
    },
    params: data
  });
}

/**
 *  根据valueOid 查询材料的id集合数据
 * @param {*} valueOid
 */
export function queryListMaterialsOidByValueOid(valueOid) {
  return request({
    url:
      process.env.VUE_APP_KSTB_ROUTE_PATH +
      `/yxpz/optionValueMaterialsRel/queryListMaterialsOidByValueOid/${valueOid}`,
    method: "post",
    headers: {
      "Content-Type": "application/json;charset=UTF-8"
    }
  });
}

/**
 * 保存选项关系配置数据
 * @param {*} data
 */
export function saveOrUpdateOptionRelationConfig(data) {
  return request({
    url:
      process.env.VUE_APP_KSTB_ROUTE_PATH +
      "/yxpz/optionRelationConfig/saveOrUpdate",
    method: "post",
    headers: {
      "Content-Type": "application/json;charset=UTF-8"
    },
    data: data
  });
}

/**
 * 查询配置分页数据
 * @param {*} params
 */
export function queryPages(params) {
  return request({
    url:
      process.env.VUE_APP_KSTB_ROUTE_PATH +
      "/yxpz/optionRelationConfig/queryPages",
    method: "get",
    params: params
  });
}

/**
 * 通过id查询选项关系配置数据
 * @param {*} id
 */
export function queryOptionRelationConfigById(id) {
  return request({
    url:
      process.env.VUE_APP_KSTB_ROUTE_PATH +
      `/yxpz/optionRelationConfig/getById/${id}`,
    method: "post",
    headers: {
      "Content-Type": "application/json;charset=UTF-8"
    }
  });
}

/**
 * 根据ids删除选项关系配置数据
 * @param {*} ids
 */
export function deleteOptionRelationConfigByIds(ids) {
  return request({
    url:
      process.env.VUE_APP_KSTB_ROUTE_PATH +
      "/yxpz/optionRelationConfig/deleteByIds",
    method: "get",
    params: {
      ids: ids
    }
  });
}

/**
 * 查询选项关系的配置组合是否存在，通过HDLOid ，titleOids，valueOids进行查询
 * @param {*} params
 */
export function hasExistOptionRelationConfig(params) {
  return request({
    url:
      process.env.VUE_APP_KSTB_ROUTE_PATH +
      "/yxpz/optionRelationConfig/hasExistOptionRelationConfig",
    method: "get",
    params: params
  });
}
